package com.example.common.entity

data class Res<T>(
    val code: Int,
    val message: String?,
    val data: T?
) {
    companion object {
        fun <T> success(data: T): Res<T> = Res(200, null, data)
        fun <T> error(msg: String, data: T? = null): Res<T> = Res(-1, msg, data)
        fun <T> loading(data: T? = null): Res<T> = Res(0, "Loading", data)
    }
}
